<?php

namespace app\controllers;

use Yii;
use yii\web\Controller;
use yii\web\Request;
use yii\web\Response;
use proxy\HttpProxy;
use helper\SessionHelper;

class OrderController extends SecBaseController
{
    public function actionList(){
        $request = Yii::$app->request;
        $page_code = $request->get('page_code');
        $sort_code = $request->get('sort_code');
        $sortorder = $request->get('sortorder');
        $this->remote_params['page_code'] = $page_code;
        $this->remote_params['sort_code'] = $sort_code;
        $this->remote_params['sortorder'] = $sortorder;

        $begin_time = $request->get('begin_time');
        $end_time = $request->get('end_time');
        $is_c2c = $request->get('is_c2c');
        $mobile = $request->get('mobile');
        $order_sn = $request->get('order_sn');
        $goods_type = $request->get('goods_type');
        $vender_id = $request->get('vender_id');
        $goods_price = $request->get('goods_price');
        $share_flag = $request->get('share_flag');
        

        $this->remote_params['begin_time'] = $begin_time;
        $this->remote_params['end_time'] = $end_time;
        $this->remote_params['is_c2c'] = $is_c2c;
        $this->remote_params['mobile'] = $mobile;
        $this->remote_params['order_sn'] = $order_sn;
        $this->remote_params['goods_type'] = $goods_type;
        $this->remote_params['vender_id'] = $vender_id;
        $this->remote_params['goods_price'] = $goods_price;
        $this->remote_params['share_flag'] = $share_flag;
        

        try{ 
            $ret = $this->proxy->execute('order', 'list', $this->remote_params);
            $this->return_page_values = array_merge($this->return_page_values, $ret);
        }catch(\Exception $e){
            $this->return_page_values['errno'] = $e->getCode();
            $this->return_page_values['errmsg'] = $e->getMessage();
            return $this->myRenderFile('@tpl/page/error.tpl', $this->return_page_values);
        }

        $this->return_page_values["is_vender_admin"] = $this->session->get('vender_id') > 0 ;
        
        return $this->myRenderFile('@tpl/page/order/list.tpl', $this->return_page_values);

    }

   

    
}
